{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "52cf6fb9",
   "metadata": {},
   "outputs": [],
   "source": [
    "from ConstructionDataProcessor import ConstructionDataProcessor"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "69113835",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[DEBUG] 加载施工台账数据...\n",
      "[DEBUG] 施工台账数据加载完成\n",
      "[DEBUG] 加载桩号坐标数据...\n",
      "[DEBUG] 桩号坐标数据加载完成\n",
      "[DEBUG] 加载涵洞设置信息...\n",
      "[DEBUG] 涵洞设置信息加载完成\n",
      "[DEBUG] 开始处理施工部位数据...\n",
      "[DEBUG] 步骤1: 提取施工部位信息\n",
      "[DEBUG] 步骤2: 匹配坐标\n",
      "[DEBUG] 步骤3: 合并涵洞设置信息\n",
      "[DEBUG] 处理完成！\n",
      "        轴线   类型   施工部位 匹配部位 左右幅       施工日期 强度等级  数量m³     原始桩号         最近桩号  \\\n",
      "0  K44+217  圆管涵  圆管涵基础   基础     2024-05-01  C25  68.4  K44+217      K44+220   \n",
      "1  K44+628  圆管涵  圆管涵基础   基础  左幅 2024-05-08  C25  45.0  K44+628  K44+628.020   \n",
      "2  K44+628  圆管涵  圆管涵基础   基础  右幅 2024-05-11  C25  47.0  K44+628  K44+628.020   \n",
      "3  K45+084  圆管涵  圆管涵基础   基础     2024-05-18  C25  60.0  K45+084      K45+080   \n",
      "4  K48+224  圆管涵  圆管涵基础   基础     2024-05-24  C25  60.0  K48+224      K48+224   \n",
      "\n",
      "        坐标N(X)      坐标E(Y)  两者距离(米)  涵底中心标高   实际涵长  \n",
      "0  3241873.418  496220.823     3.00   29.56  46.50  \n",
      "1  3241595.046  495922.511     0.02   32.00  62.29  \n",
      "2  3241595.046  495922.511     0.02   32.00  62.29  \n",
      "3  3241286.683  495592.060     4.00     NaN    NaN  \n",
      "4  3240696.500  492608.235     0.00     NaN    NaN  \n"
     ]
    }
   ],
   "source": [
    "# 创建实例（debug=True 开启调试输出）\n",
    "processor = ConstructionDataProcessor(\n",
    "    excel_path=r'C:\\Users\\Administrator\\Desktop\\工作常用程序\\公路资料\\检验批\\frame\\施工混凝土浇筑台账.xlsx',\n",
    "    all_piles_path=r'C:\\Users\\Administrator\\Desktop\\工作常用程序\\公路资料\\检验批\\frame\\所有的桩号.xlsx',\n",
    "    culvert_info_path=r'C:\\Users\\Administrator\\Desktop\\工作常用程序\\公路资料\\检验批\\frame\\涵洞设置一览表.xlsx',\n",
    "    debug=True\n",
    ")\n",
    "\n",
    "# 执行处理流程\n",
    "final_df = processor.process()\n",
    "\n",
    "# 输出结果\n",
    "print(final_df.head())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "70d7b956",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>轴线</th>\n",
       "      <th>类型</th>\n",
       "      <th>施工部位</th>\n",
       "      <th>匹配部位</th>\n",
       "      <th>左右幅</th>\n",
       "      <th>施工日期</th>\n",
       "      <th>强度等级</th>\n",
       "      <th>数量m³</th>\n",
       "      <th>原始桩号</th>\n",
       "      <th>最近桩号</th>\n",
       "      <th>坐标N(X)</th>\n",
       "      <th>坐标E(Y)</th>\n",
       "      <th>两者距离(米)</th>\n",
       "      <th>涵底中心标高</th>\n",
       "      <th>实际涵长</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>K44+217</td>\n",
       "      <td>圆管涵</td>\n",
       "      <td>圆管涵基础</td>\n",
       "      <td>基础</td>\n",
       "      <td></td>\n",
       "      <td>2024-05-01</td>\n",
       "      <td>C25</td>\n",
       "      <td>68.4</td>\n",
       "      <td>K44+217</td>\n",
       "      <td>K44+220</td>\n",
       "      <td>3241873.418</td>\n",
       "      <td>496220.823</td>\n",
       "      <td>3.00</td>\n",
       "      <td>29.56</td>\n",
       "      <td>46.50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>K44+628</td>\n",
       "      <td>圆管涵</td>\n",
       "      <td>圆管涵基础</td>\n",
       "      <td>基础</td>\n",
       "      <td>左幅</td>\n",
       "      <td>2024-05-08</td>\n",
       "      <td>C25</td>\n",
       "      <td>45.0</td>\n",
       "      <td>K44+628</td>\n",
       "      <td>K44+628.020</td>\n",
       "      <td>3241595.046</td>\n",
       "      <td>495922.511</td>\n",
       "      <td>0.02</td>\n",
       "      <td>32.00</td>\n",
       "      <td>62.29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>K44+628</td>\n",
       "      <td>圆管涵</td>\n",
       "      <td>圆管涵基础</td>\n",
       "      <td>基础</td>\n",
       "      <td>右幅</td>\n",
       "      <td>2024-05-11</td>\n",
       "      <td>C25</td>\n",
       "      <td>47.0</td>\n",
       "      <td>K44+628</td>\n",
       "      <td>K44+628.020</td>\n",
       "      <td>3241595.046</td>\n",
       "      <td>495922.511</td>\n",
       "      <td>0.02</td>\n",
       "      <td>32.00</td>\n",
       "      <td>62.29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>K45+084</td>\n",
       "      <td>圆管涵</td>\n",
       "      <td>圆管涵基础</td>\n",
       "      <td>基础</td>\n",
       "      <td></td>\n",
       "      <td>2024-05-18</td>\n",
       "      <td>C25</td>\n",
       "      <td>60.0</td>\n",
       "      <td>K45+084</td>\n",
       "      <td>K45+080</td>\n",
       "      <td>3241286.683</td>\n",
       "      <td>495592.060</td>\n",
       "      <td>4.00</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>K48+224</td>\n",
       "      <td>圆管涵</td>\n",
       "      <td>圆管涵基础</td>\n",
       "      <td>基础</td>\n",
       "      <td></td>\n",
       "      <td>2024-05-24</td>\n",
       "      <td>C25</td>\n",
       "      <td>60.0</td>\n",
       "      <td>K48+224</td>\n",
       "      <td>K48+224</td>\n",
       "      <td>3240696.500</td>\n",
       "      <td>492608.235</td>\n",
       "      <td>0.00</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>347</th>\n",
       "      <td>K44+861</td>\n",
       "      <td>盖板涵</td>\n",
       "      <td>左幅盖板</td>\n",
       "      <td>盖板</td>\n",
       "      <td></td>\n",
       "      <td>2025-05-07</td>\n",
       "      <td>C40</td>\n",
       "      <td>24.0</td>\n",
       "      <td>K44+861</td>\n",
       "      <td>K44+860</td>\n",
       "      <td>3241436.778</td>\n",
       "      <td>495752.906</td>\n",
       "      <td>1.00</td>\n",
       "      <td>40.30</td>\n",
       "      <td>44.64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>348</th>\n",
       "      <td>K44+861</td>\n",
       "      <td>盖板涵</td>\n",
       "      <td>左幅盖板第二模</td>\n",
       "      <td>盖板</td>\n",
       "      <td></td>\n",
       "      <td>2025-05-09</td>\n",
       "      <td>C40</td>\n",
       "      <td>13.0</td>\n",
       "      <td>K44+861</td>\n",
       "      <td>K44+860</td>\n",
       "      <td>3241436.778</td>\n",
       "      <td>495752.906</td>\n",
       "      <td>1.00</td>\n",
       "      <td>40.30</td>\n",
       "      <td>44.64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>349</th>\n",
       "      <td>K44+861</td>\n",
       "      <td>盖板涵</td>\n",
       "      <td>左幅八字墙基础</td>\n",
       "      <td>八字墙</td>\n",
       "      <td></td>\n",
       "      <td>2025-05-11</td>\n",
       "      <td>C20</td>\n",
       "      <td>6.0</td>\n",
       "      <td>K44+861</td>\n",
       "      <td>K44+860</td>\n",
       "      <td>3241436.778</td>\n",
       "      <td>495752.906</td>\n",
       "      <td>1.00</td>\n",
       "      <td>40.30</td>\n",
       "      <td>44.64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>350</th>\n",
       "      <td>K42+867</td>\n",
       "      <td>圆管涵</td>\n",
       "      <td>一字墙</td>\n",
       "      <td>一字墙</td>\n",
       "      <td></td>\n",
       "      <td>2025-05-12</td>\n",
       "      <td>C20</td>\n",
       "      <td>9.0</td>\n",
       "      <td>K42+867</td>\n",
       "      <td>K42+866.590</td>\n",
       "      <td>3242794.987</td>\n",
       "      <td>497211.956</td>\n",
       "      <td>0.41</td>\n",
       "      <td>35.06</td>\n",
       "      <td>50.50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>351</th>\n",
       "      <td>K41+500</td>\n",
       "      <td>盖板涵</td>\n",
       "      <td>基础</td>\n",
       "      <td>基础</td>\n",
       "      <td></td>\n",
       "      <td>2025-05-15</td>\n",
       "      <td>C35</td>\n",
       "      <td>60.0</td>\n",
       "      <td>K41+500</td>\n",
       "      <td>K41+500</td>\n",
       "      <td>3243160.345</td>\n",
       "      <td>498486.035</td>\n",
       "      <td>0.00</td>\n",
       "      <td>31.30</td>\n",
       "      <td>39.30</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>352 rows × 15 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "          轴线   类型     施工部位 匹配部位 左右幅       施工日期 强度等级  数量m³     原始桩号  \\\n",
       "0    K44+217  圆管涵    圆管涵基础   基础     2024-05-01  C25  68.4  K44+217   \n",
       "1    K44+628  圆管涵    圆管涵基础   基础  左幅 2024-05-08  C25  45.0  K44+628   \n",
       "2    K44+628  圆管涵    圆管涵基础   基础  右幅 2024-05-11  C25  47.0  K44+628   \n",
       "3    K45+084  圆管涵    圆管涵基础   基础     2024-05-18  C25  60.0  K45+084   \n",
       "4    K48+224  圆管涵    圆管涵基础   基础     2024-05-24  C25  60.0  K48+224   \n",
       "..       ...  ...      ...  ...  ..        ...  ...   ...      ...   \n",
       "347  K44+861  盖板涵     左幅盖板   盖板     2025-05-07  C40  24.0  K44+861   \n",
       "348  K44+861  盖板涵  左幅盖板第二模   盖板     2025-05-09  C40  13.0  K44+861   \n",
       "349  K44+861  盖板涵  左幅八字墙基础  八字墙     2025-05-11  C20   6.0  K44+861   \n",
       "350  K42+867  圆管涵      一字墙  一字墙     2025-05-12  C20   9.0  K42+867   \n",
       "351  K41+500  盖板涵       基础   基础     2025-05-15  C35  60.0  K41+500   \n",
       "\n",
       "            最近桩号       坐标N(X)      坐标E(Y)  两者距离(米)  涵底中心标高   实际涵长  \n",
       "0        K44+220  3241873.418  496220.823     3.00   29.56  46.50  \n",
       "1    K44+628.020  3241595.046  495922.511     0.02   32.00  62.29  \n",
       "2    K44+628.020  3241595.046  495922.511     0.02   32.00  62.29  \n",
       "3        K45+080  3241286.683  495592.060     4.00     NaN    NaN  \n",
       "4        K48+224  3240696.500  492608.235     0.00     NaN    NaN  \n",
       "..           ...          ...         ...      ...     ...    ...  \n",
       "347      K44+860  3241436.778  495752.906     1.00   40.30  44.64  \n",
       "348      K44+860  3241436.778  495752.906     1.00   40.30  44.64  \n",
       "349      K44+860  3241436.778  495752.906     1.00   40.30  44.64  \n",
       "350  K42+866.590  3242794.987  497211.956     0.41   35.06  50.50  \n",
       "351      K41+500  3243160.345  498486.035     0.00   31.30  39.30  \n",
       "\n",
       "[352 rows x 15 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "final_df"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.22"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
